<!-- 从业者-个人求职-岗位详情-->
<template>
	<view class="resume-container">
		<!-- 用户基本信息 -->
		<view class="user-info">
			<view class="info-main">
				<view class="name-line">
					<text class="name">{{jobData.gwi_name}}</text>
				</view>
				<view class="meta-info">
					<text>{{jobData.gwi_workaddr}}</text>
					<text>|</text>
					<text>{{jobData.gwi_exptype}}</text>
					<text>|</text>
					<text>{{jobData.gwi_type}}</text>
				</view>
			</view>
		</view>

		<!-- 分隔线 -->
		<u-line color="#c1c3c7" length="90%" margin="0 10px"></u-line>

		<!-- 岗位职责 -->
		<view class="section">
			<view class="section-header">
				<text class="title">岗位职责</text>
			</view>
			<view class="section-content">
				<!-- 加载更多 -->
				<u-read-more :show-height="200" :toggle="true" :shadow-style="shadowStyle" color="#03B8CD">
					<rich-text :nodes="jobData.gwi_gangweiduty"></rich-text>
				</u-read-more>
			</view>
		</view>

		<!-- 分隔线 -->
		<u-line color="#c1c3c7" length="90%" margin="0 10px"></u-line>

		<!-- 任职要求 -->
		<view class="section">
			<view class="section-header">
				<text class="title">任职要求</text>
			</view>
			<view class="section-content">
				<!-- 加载更多 -->
				<u-read-more :show-height="200" :toggle="true" :shadow-style="shadowStyle" color="#03B8CD">
					<rich-text :nodes="jobData.gwi_renzhiduty"></rich-text>
				</u-read-more>
			</view>
		</view>

		<!-- 分隔线 -->
		<u-line color="#c1c3c7" length="90%" margin="0 10px"></u-line>

		<!-- 员工福利 -->
		<view class="section">
			<view class="section-header">
				<text class="title">员工福利</text>
			</view>
			<view class="section-content">
				<view class="timeSection">
					<text class="title-name">五险一金</text>
					<text class="title-time">定期体检</text>
				</view>
			</view>
		</view>

		<!-- 分隔线 -->
		<u-line color="#c1c3c7" length="90%" margin="0 10px"></u-line>

		<!-- 顶部用户信息区域 -->
		<view class="company-info" @click="navigateTo">
			<!-- 头像 -->
			<view class="info-left">
				<u-avatar mode="square" size="100" :src="jobData.jginfo.qyxx.logo_img_uri[0].url"></u-avatar>
			</view>
			<view class="info-right">
				<view class="company-name">{{ jobData.jginfo.yyzz.yyzz_name}}</view>
				<view class="phone">{{ jobData.jginfo.qyxx.qyxx_name }}</view>
			</view>
			<view>
				<u-section :show-line="false" sub-title=" "></u-section>
			</view>
		</view>

		<!-- 工作地点和地图 -->
		<view class="section">
			<view class="section-header">
				<text class="title">工作地址：详细具体的地址</text>
			</view>
			<!-- 地图定位 -->
			<view class="map-container">
				<map style="width: 100%; height: 200px;" :latitude="latitude" :longitude="longitude" :markers="markers"
					show-location></map>
				<view class="map-tip">地图定位</view>
			</view>
		</view>

		<!-- 分隔线 -->
		<u-line color="#c1c3c7" length="90%" margin="0 10px"></u-line>

		<!-- 空块 -->
		<view class="section">
			<view class="section-header">
				<text class="title"></text>
			</view>
			<view class="section-content">
				<view class="workSection">
				</view>
				<view class="timeSection">
				</view>
			</view>
		</view>
		<!-- 底部按钮 -->
		<view class="button-group">
			<u-button type="primary" :custom-style="btuStyle"  @click="publishJob" shape="circle">
				投递简历
			</u-button>
		</view>

	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 加载更多按钮
				shadowStyle: {
					backgroundImage: "linear-gradient(-180deg, rgba(255, 255, 255, 0) 0%, #F1F7F7 80%)",
					paddingTop: "300rpx",
					marginTop: "-300rpx",
					
				},
				// 投递按钮
				btuStyle: {
					"backgroundColor": "#03B8CD",
					"color": "#ffffff"
				},
				// 企业信息头像与内容
				userInfo: {
					avatar: 'https://cdn.uviewui.com/uview/template/niannian.jpg',
					companyName: '企业名称',
					phone: '156****6666',
					companyType: '养老院',
					businessStatus: '营业中',
					licenseStatus: '已认证'
				},
				// 导航信息
				latitude: 39.90469, // 企业纬度
				longitude: 116.40717, // 企业经度
				markers: [{
					id: 1,
					latitude: 39.90469,
					longitude: 116.40717,
					title: '企业名称',
					iconPath: '/static/location.png'
				}],
				expanded: false, // 控制个人介绍是否展开
				jobFlowID: '', ///查询某个岗位从上一个页面过来的ID
				jobData: []
			}
		},
		onLoad(options) {
			this.jobFlowID = options.flowid

			
		},
		onShow() {			
			this.$u.api.querygw({
				gwiflowid : this.jobFlowID
			}).then(res => {
				console.log('某个岗位：', res)
				this.jobData = res.data.base_info[0]
			})
			
		},
		methods: {
			// 投递简历
			publishJob() {
				console.log('投递简历usercode', uni.getStorageSync('usercode'))
				this.$u.api.toudijianli({
					"usercode": uni.getStorageSync('usercode'),  //#用户code
					"gwiflowid":this.jobFlowID, //#岗位信息code
				}).then(res =>{
					console.log('投递简历：', res)
					
				})
			},
			// 企业信息
			navigateTo() {
				uni.navigateTo({
					url: `/pages/Practitioner/applyJob/CompanyInfo?flowid=${this.jobFlowID}`
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.resume-container {
		// padding: 30rpx;
		background-color: #F1F7F7;
		// min-height: 160vh;

		// 企业信息
		.company-info {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 30rpx;
			background-color: #F1F7F7;
			border-radius: 16rpx;
			margin-bottom: 4rpx;

			.info-right {
				flex: 1;
				display: flex;
				flex-direction: column;
				justify-content: center;
				margin-left: 20px;


				.company-name {
					font-size: 36rpx;
					font-weight: bold;
					margin-bottom: 10rpx;
				}

				.phone {
					font-size: 28rpx;
					color: #666;
					margin-bottom: 10rpx;
				}

				.company-type {
					font-size: 26rpx;
					color: #888;
				}
			}
		}


		.user-info {
			display: flex;
			background-color: #F1F7F7;
			border-radius: 16rpx;
			padding: 30rpx;
			// margin-bottom: 5rpx;

			.avatar-container {
				margin-right: 30rpx;

				.avatar {
					// 2寸照片的宽、高
					// width: 200px;
					// height: 280px;
					// 1寸照片的宽、高
					width: 74px;
					height: 99px;
					// border-radius: 50%;
					background-color: #F1F7F7;
					border: 2rpx solid #f0f0f0;
				}
			}

			.info-main {
				flex: 1;

				.name-line {
					display: flex;
					align-items: center;
					// margin-bottom: 30rpx;

					.name {
						font-size: 36rpx;
						font-weight: bold;
						color: #333;
						margin-right: 20rpx;
					}

					.gender {
						font-size: 24rpx;
						color: #2979ff;
						background-color: #F1F7F7;
						padding: 4rpx 15rpx;
						border-radius: 20rpx;
					}
				}

				.meta-info {
					display: flex;
					align-items: center;
					font-size: 26rpx;
					color: #666;
					// margin-bottom: 30rpx;

					text {
						margin-right: 15rpx;

						&:last-child {
							margin-right: 0;
						}
					}
				}

				.contact-info {
					.phone {
						// display: block;
						font-size: 26rpx;
						color: #666;
						// margin-bottom: 8rpx;
						margin-right: 10px;

						&:last-child {

							margin-bottom: 0;
						}
					}
				}
			}
		}

		.section {
			background-color: #F1F7F7;
			border-radius: 16rpx;
			padding: 30rpx;

			.section-header {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding-bottom: 20rpx;
				// border-bottom: 1rpx solid #f0f0f0;			


				.title {
					font-size: 32rpx;
					font-weight: bold;
					color: #333;
				}

				.status {
					font-size: 26rpx;
					color: #19be6b;
				}
			}



			.section-content {
				.intention-item {
					display: flex;
					font-size: 28rpx;
					color: #666;
					margin-bottom: 15rpx;

					.label {
						color: #333;
						font-weight: bold;
						margin-right: 10rpx;
					}
				}


				.intro-text {
					font-size: 28rpx;
					color: #666;
					line-height: 1.6;

					&.collapsed {
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 3;
						overflow: hidden;
					}
				}

				.expand-btn {
					display: flex;
					align-items: center;
					justify-content: flex-end;
					color: #2979ff;
					font-size: 26rpx;
					margin-top: 15rpx;

					.u-icon {
						margin-left: 8rpx;
					}
				}
			}

		}

		// 岗位与时间
		.timeSection {
			margin: 10px 0;

			.title-name {
				margin-right: 20px;
			}
		}


		.button-group {
			position: fixed;
			bottom: 0;
			left: 0;
			right: 0;
			padding: 20rpx 30rpx;
			background-color: #F1F7F7;
			display: flex;
			justify-content: space-between;
			box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);

			// 此样式主要为了适配wx小程序的按钮
			/deep/ .u-size-default {
				width: 350px;
			}

			.u-btn {
				flex: 1;

				&:first-child {
					margin-right: 20rpx;
				}
			}
		}
		
		.map-container {
			background-color: #bebebe;
		}


	}
</style>